package main.com.hushengjin.singleton;

/**
 * 双重锁/双检锁校验（DCL：double-checked locking）
 */
public class DCLSingleton {
    private volatile static DCLSingleton instance;
    private DCLSingleton() {}
    public static DCLSingleton getInstance() {
        if (instance == null) {
            synchronized (DCLSingleton.class) {
                if (instance == null) instance = new DCLSingleton();
            }
        }
        return instance;
    }
}
